home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ FileEx Hide 1.xpl < prev    next >
Text File  |  2001-04-16  |  4KB  |  123 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 3.1"
  2. "TYPE"="9"
  3. "COUNT"="1"
  4. "UIPATH"="Appearance\Files&Folders\Files"
  5. "NAME"="Show/Hide File Extensions"
  6. "VERSION"="2.04"
  7. "LANGUAGE"="VBScript"
  8. "TEXT 1"="Display extension"
  9. "DESCRIPTION 1"="This plug-in can be used to hide or show the extensions for some files. For example a file called "XTEQ.URL" would appear as "XTEQ" if you disable the display of the extension."
  10. "DESCRIPTION 2"="If the checkbox left from an entry is checked, it means "DISPLAY THE EXTENSION". If unchecked, it means "DO NOT DISPLAY THE EXTENSION"."
  11. "AUTHOR"="Xteq Systems"
  12. "CONTACTURL"="http://www.xteq.com"
  13. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  14. "COMMENT 1"="Thanks to CptSiskoX for his help!"
  15.  
  16.  
  17. 'ONLY EDIT THE LINE BELOW !!!!
  18. '******************************************************************
  19. sVals=Array(".lnk",".pif",".URL",".scf",".shs",".shb",".job",".jse",".vbe",".vbs",".js",".wsf",".doc")
  20. '******************************************************************
  21.  
  22. sPath="HKLM\Software\Classes\"
  23. sValue="\NeverShowExt"
  24.  
  25.  
  26. SUB Plugin_Initialize
  27.  for i=0 to UBound(sVals)
  28.      sItem=sVals(i)
  29.  
  30.      'get file description
  31.      sP=sPath & sItem & "\@"
  32.      sBase=RegReadValue(sP)
  33.      if IsEmpty(sBase)=true then
  34.         'has no description, don't need to go any further
  35.         Call SetUI(i+1,sItem,true)
  36.      else 
  37.         'HKLM\Software\Classes\XX File\NeverShowEx          
  38.         sP=sPath & sBase & sValue 
  39.         if RegValueExists(sP)=true then
  40.            'NeverShowExt found!
  41.            Call SetUI(i+1,sItem,false)
  42.         else
  43.            'not found
  44.            Call SetUI(i+1,sItem,true)
  45.         end if
  46.      end if
  47.  next 
  48. END SUB
  49.  
  50.  
  51. Sub SetUI(ItemNr,Typ,Activated)
  52.     sDesc=GetFileDescription(Typ)
  53.     Call SetUIElement(ItemNr, sDesc & " (" & Typ & ")" )
  54.     Call SetUIElementEx(ItemNr,Activated)
  55. End Sub
  56.  
  57.  
  58.  
  59. 'VERSION 1.1
  60. 'returns the readable description for a file TYPE. Input is the
  61. 'raw file type (e.g. ".TXT"). 
  62. Function GetFileDescription(DotType)
  63.   sxd_BasePath="HKLM\Software\Classes\"
  64.  
  65.   sxd_Path=sxd_BasePath & DotType & "\@"
  66.   sxd_Val=RegReadValue(sxd_Path)
  67.  
  68.   if IsEmpty(sxd_Val)=true then
  69.      'extended description not found! return default
  70.      GetFileDescription="<UNKNOWN>"
  71.   else
  72.      'found, now get the "real" description
  73.      sxd_Path=sxd_BasePath & sxd_Val & "\@"
  74.      sxd_Name=RegReadValue(sxd_Path)
  75.      
  76.      if IsEmpty(sxd_Name)=true then
  77.         'argh! 
  78.         GetFileDescription="<UNKNOWN>"
  79.      else
  80.         GetFileDescription=sxd_Name
  81.      end if
  82.   end if
  83.  
  84. End Function
  85.  
  86.  
  87. 'Called when the Plugin should apply the changes
  88. SUB Plugin_Apply(ElementIndex,ElementSubIndex)
  89.  for i=0 to UBound(sVals)
  90.  
  91.      sItem=sVals(i)
  92.  
  93.      'get file description
  94.      sP=sPath & sItem & "\@"
  95.      sBase=RegReadValue(sP)
  96.      if IsEmpty(sBase)=true then
  97.         Call MsgError("Unable to set for type " & sItem & " as this type has no description!")
  98.      else
  99.         'HKLM\Software\Classes\XX File\NeverShowEx          
  100.         sP=sPath & sBase & sValue 
  101.         if GetUIElementEx(i+1)=true then
  102.            'show extension
  103.            if RegValueExists(sP) then
  104.               Call RegDeleteValue(sP)
  105.            end if
  106.         else
  107.            'hide extension
  108.            Call RegWriteValue(sP,"",1)
  109.         end if 
  110.      end if
  111.  
  112.  next 
  113.  
  114.  Call Logoff()
  115. END SUB
  116.  
  117.  
  118. 'Called when the Plugin is about to be removed from memory
  119. SUB Plugin_Terminate
  120. END SUB
  121.  
  122.  
  123.